//管理员--表现层
var express = require('express');
var router = express.Router();
const {
    reg,
    login,
    isUse
} = require("../service/adminsService")


/* GET users listing. */
// 登录{ adminName, adminPassword }
router.get('/login', async function (req, res, next) {
    const { adminName, adminPassword } = req.query;
    const status = await login({ adminName, adminPassword });
    res.send(status);
});
// 注册
router.post('/reg', async function (req, res, next) {
    const { adminName, adminPassword } = req.body;
    const status = await reg({ adminName, adminPassword });
    res.send(
        status
    );
});

// 验证用户名
router.post('/isUse', async function (req, res, next) {
    const { adminName } = req.body;
    const status = await isUse({ adminName });
    res.send(
        status
    );
});

module.exports = router;